using System.Text;
using CommandLineMapper;

namespace TestProgram {
    public class ApplicationSettings {
        
        [CommandOption(typeof(string), new[] {"s", "server"})]
        public string Server { get; set; }
        
        [CommandOption(typeof(string), new[] { "db", "database" })]
        public string Database { get; set; }
        
        [CommandOption(typeof(string), new[] { "u", "user" })]
        public string UserId { get; set; }
        
        [CommandOption(typeof(string), new[] { "p", "password" })]
        public string Password { get; set; }

        [CommandOption(typeof(bool), new[] { "sspi"})]
        public bool UseWindowsAuthentication { get; set; }

        [CommandOption(typeof(int), new[] {"try"})]
        public int ConnectionTryCount { get; set; }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder(100);
            builder.AppendLine(string.Format("Server: {0}", Server));
            builder.AppendLine(string.Format("Database: {0}", Database));
            builder.AppendLine(string.Format("UserId: {0}", UserId));
            builder.AppendLine(string.Format("Password: {0}", Password));
            builder.AppendLine(string.Format("Use Windows Authentication: {0}", UseWindowsAuthentication));
            builder.AppendLine(string.Format("Connection try count: {0}", ConnectionTryCount));
            return builder.ToString();
        }
    }
}